package com.itheima.mapper;

import com.itheima.domain.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface  StudentMapper {
    @Select("select * from student")
    List<Student> findAll();

    @Select("select * from student where id = #{id}")
    Student selectById(Integer id);

    @Insert("insert into student values (#{id},#{name},#{age})")
    Integer insert(Student stu);

   @Delete("delete from student where id = #{id}")
    Integer delete(Integer id);

   @Update("update student set name = #{name},age = #{age} where id = #{id}")
    Integer update(Integer id);

    @Select("select * from student where id = #{id}")
    List<Student> findByName(String name);

   @Select("select * from student where name = #{name} or age = #{age}")
    List<Student> findNameOrAge(@Param("name") String name, @Param("age") Integer age);
}
